import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "./utils/mtAxios"
import"./apis"
import 'reset-css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './views/minxin'
import CollapseTransition from 'element-ui/lib/transitions/collapse-transition'
import 'element-ui/lib/theme-chalk/base.css'

Vue.component(CollapseTransition.name, CollapseTransition)
Vue.config.productionTip = false
Vue.use(ElementUI);

router.beforeEach((to,from,next)=>{
	console.log(to)
	if(to.name == "Login"){
		next();
		return;
	}
	
	var token = localStorage.getItem("token");
	if(token){
		next();
	}else{
		var path = to.path;
		next({path:"/Login",query:{redirectPath:path}})
		
	}
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
